;
class canvasToVideo {


	constructor({}) {

	}

	canv;
	av;
	recorder;
	_h;
	hBegin(canvas, video) {


		this.canv = canvas;
		this.av = video;
		let stream = canvas.captureStream();

		//录制
		var recorder = new MediaRecorder(stream, {
			mimeType: 'video/webm'
		});
		//video.srcObject = stream;
		//	video.src = recorder.stream;
		const data = [];

		//停止后开始调用
		recorder.ondataavailable = function(event) {
			if (event.data && event.data.size) {
				//data.push(event.data);			

				this.av.src = URL.createObjectURL(new Blob([event.data], {
					type: 'video/webm'
				}));
			}
		}
		this.recorder = recorder;
		this.hHand();
	}

	hHand() {

		this.recorder.start();
		this.recorder.stop();
		setTimeout(() => {
			this.hHand();
		}, 25);
	}
	hStop() {}

	// const url = URL.createObjectURL(new Blob(data, { type: 'video/webm' }));
	// document.querySelector("#videoContainer").style.display = "block";
	// document.querySelector("video").src = url;
}